package Opeartion;

import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class FindBook implements Operation{
    @Override
    public void work(Booklist booklist) {
        System.out.println("查找图书....");
        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入查找书的名字：");
        String name=scanner.nextLine();

        int currentSize=booklist.getBrrownum();
        for (int i = 0; i < currentSize; i++) {
            if (booklist.getBook(i).getName().equals(name)){
                System.out.println("找到了！");
                System.out.println(booklist.getBook(i));
                return;
            }
        }
        System.out.println("没有你要找的书.....");
    }
}
